/*
 * @Author: gxn
 * @Date: 2020-08-18 09:35:46
 * @LastEditors: gxn
 * @LastEditTime: 2020-08-21 00:06:38
 * @Description: file content
 */
import { uniqueId } from 'lodash'

import daily from './modules/daily'
import statistics from './modules/statistics'
import admin from './modules/admin'
import dataManagement from './modules/dataManagement'
/**
 * @description 给菜单数据补充上 path 字段
 * @description https://github.com/d2-projects/d2-admin/issues/209
 * @param {Array} menu 原始的菜单数据
 */
function supplementPath (menu) {
  return menu.map(e => ({
    ...e,
    path: e.path || uniqueId('d2-menu-empty-'),
    ...e.children ? {
      children: supplementPath(e.children)
    } : {}
  }))
}

export const menuHeader = supplementPath([
  daily,
  dataManagement,
  statistics,
  admin,
])

export const menuAside = menuHeader
